<?php

class Mentors extends Model {
	
	function Mentors()
	{
		parent::Model();
	}

	function select_all($subject)
	{
		$query = $this->db->query('SELECT DISTINCT t1.Username, FirstName, MiddleName, LastName, ID
FROM User AS t1, Mentor AS t2
WHERE t1.Username = t2.Username AND t2.Subject = ?', $subject);
		return $query;
	}

	function sign_up($array)
	{
		$this->db->insert('Mentor', $array);
		return true;
	}

	function is_a_mentor($array)
	{
		$this->db->where($array);
		$query = $this->db->get('Mentor');
		return $query->num_rows();
	}

	function delete($id)
	{
		$this->db->delete('Mentor', array('ID'=>$id));
		return TRUE;
	}
}

?>
